<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of addcategories
 *
 * @author IT
 */
class addcategories extends db {
    
    function addar()
    {
        $data1 = $_POST["title"];
        $data2 = $_POST["overview"];
        $data3 = $_POST["body"];
        $data4 = $_POST["categories"];
        $query = " INSERT INTO articles (title,overview,body,id_category) VALUES ('$data1','$data2','$data3','$data4') ";
        $data = $this->ketnoi($query);
        return $data;
    }
    function upda($data1,$data2,$data3,$data4)
    {
        $id = $_GET["id"];
        $query = " UPDATE articles SET title =  '$data1' ,overview = '$data2' ,body = '$data3' ,id_category = '$data4' WHERE id = " .$id ;
        $data = $this->ketnoi($query);
        return $data;
    }
}
